package com.intellagric.controller.module.loganalyse;

import com.intellagric.common.pojo.LayuiDataGridResult;
import com.intellagric.common.pojo.ResponseMessage;
import com.intellagric.pojo.LogAnalyzeJobCondition;
import com.intellagric.service.module.loganalyse.LogAnalyseJobConditionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @Auther: zhy
 * @Date: 2019/5/11
 * @Description: 日志分析过滤规则管理
 */
@Controller
public class LogAnalyseJobConditionController {

    @Autowired
    private LogAnalyseJobConditionService logAnalyseJobConditionService;
    
    /**
     * 添加日志分析过滤规则信息
     * @Param logAnalyzeJobCondition
     * @return ResponseMessage
     */
    @RequestMapping("/log/analysejob/condition/add")
    @ResponseBody
    public ResponseMessage add(LogAnalyzeJobCondition logAnalyzeJobCondition) {
        return logAnalyseJobConditionService.addLogAnalyzeJobCondition(logAnalyzeJobCondition);
    }


    /**
     * 删除日志分析过滤规则信息
     * @Param id
     * @return ResponseMessage
     */
    @RequestMapping("/log/analysejob/condition/delete")
    @ResponseBody
    public ResponseMessage delete(int id) {
        return logAnalyseJobConditionService.deleteLogAnalyzeJobCondition(id);
    }

    /**
     * 修改日志分析过滤规则信息
     * @Param logAnalyzeJobCondition
     * @return ResponseMessage
     */
    @RequestMapping("/log/analysejob/condition/edit")
    @ResponseBody
    public ResponseMessage edit(LogAnalyzeJobCondition logAnalyzeJobCondition) {
        return logAnalyseJobConditionService.editLogAnalyzeJobCondition(logAnalyzeJobCondition);
    }

    /**
     * 查询日志分析过滤规则信息
     * @return LogAnalyzeJobCondition
     */
    @RequestMapping("/log/analysejob/condition/{id}")
    @ResponseBody
    public LogAnalyzeJobCondition get(@PathVariable int id) {
        return logAnalyseJobConditionService.queryLogAnalyzeJobConditionById(id);
    }

    /**
     * 查询日志分析过滤规则信息
     * @return LogAnalyzeJobCondition
     */
    @RequestMapping("/log/analysejob/condition/query")
    @ResponseBody
    public LayuiDataGridResult getListByJobid(int jobid) {
         return logAnalyseJobConditionService.queryLogAnalyzeJobConditionByJobId(jobid);
    }

    /**
     * 查询日志分析过滤规则信息列表
     * @return LayuiDataGridResult
     */
    @RequestMapping("/log/analysejob/condition/list")
    @ResponseBody
    public LayuiDataGridResult getList() {
        return logAnalyseJobConditionService.queryLogAnalyzeJobConditionList();
    }

    /**
     * 分页查询日志分析过滤规则信息列表
     * @return LayuiDataGridResult
     */
    @RequestMapping("/log/analysejob/condition/page")
    @ResponseBody
    public LayuiDataGridResult getPage(int page,int limit) {
        return logAnalyseJobConditionService.queryLogAnalyzeJobConditionList();
    }


}
